<template>
  <div>
    <div class="detail-aside">
      <h4 class="title">相关攻略</h4>
      <div class="recommend-list" v-for="(recommend,index) in recommendlist" :key="index">
        <a :href="'/post/postdetails?id='+recommend.id" class="recommend-item">
          <div class="detail-box">
            <div class="cover">
              <img v-if="recommend.images.length>0" :src="recommend.images[0]" alt />
              <img v-else src="@/assets/test.jpg" alt />
            </div>
            <div class="aside-text">
              <h4 class="aside-title">{{recommend.title}}</h4>
              <p>
                {{$moment(recommend.created_at).format("YY-MM-DD hh:mm")}} 阅读
                {{recommend.watch}}
              </p>
            </div>
          </div>
        </a>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["recommendlist"]
};
</script>
<style lang="less" scoped>
.detail-aside {
  width: 100%;
  .title {
    font-size: 18px;
    font-weight: 400;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
  }
  .recommend-list {
    a {
      &:hover {
        color: #000 !important;
      }
    }
    .recommend-item {
      padding: 20px 0;
      display: block;
      border-bottom: 1px solid #ddd;
      .detail-box {
        display: flex;
        .cover {
          width: 100px;
          height: 80px;
          flex-shrink: 0;
          background-color: #ddd;
          overflow: hidden;
          margin-right: 10px;
          img {
            width: 100%;
            height: 100%;
            object-fit: cover;
          }
        }
        .aside-text {
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          .aside-title {
            font-weight: normal;
            line-height: 1.4em;
            height: 2.8em;
            display: -webkit-box;
            text-overflow: ellipsis;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            overflow: hidden;
          }
          p {
            font-size: 12px;
            color: #999;
          }
        }
      }
    }
  }
}
</style>